package fpt.edu.vn.action;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

import fpt.edu.vn.dao.AddnewDao;
import fpt.edu.vn.dao.TopicsDao;
import fpt.edu.vn.model.Districts;
import fpt.edu.vn.model.Provinces;
import fpt.edu.vn.model.Statustopics;
import fpt.edu.vn.model.Topics;
import fpt.edu.vn.model.Topictypes;

/* 
 * AdminLogsAction.java 
 *  
 * 0.1
 * 
 * 10/15/2012 
 *  
 * Copyright notice 
 *  
 * Modification Logs: 
 *   DATE        AUTHOR      DESCRIPTION 
 *  -------------------------------------------------------- 
 *  15-Oct-2012  ThuongND    Create new 
 */
public class AdminLogsAction extends ActionSupport {

	private static final long serialVersionUID = 1L;
	private String email;

	private String Username;
	private int activityHistoryId;

	private String ipAddress;

	private String userName;

	private int topicId;

	private int activityTypeId;

	private Date createDate;
	private String description;
	
	private TopicsDao topicdao = new TopicsDao();
	
	private List<Object> lstActivity;
	// For SessionAware
	Map<String, Object> session;
	
	
	public String execute() {
		session = ActionContext.getContext().getSession();
		if (session.containsKey("userRoleIdss")) {
			email = (String) session.get("emailss");
			int isAdmin = (Integer) session.get("userRoleIdss");
			if (isAdmin == 1) {
				lstActivity = topicdao.adminShowActivityhistorys();
				return SUCCESS;
			}
		}
		return ERROR;

	}

	public Date getSysdate() {
		Date date = new Date();
		return date;
	}

	public String getStrDate() {
		String curdate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
				.format(Calendar.getInstance().getTime());
		return curdate;
	}
	
	
	public List<Object> getLstActivity() {
		return lstActivity;
	}

	public void setLstActivity(List<Object> lstActivity) {
		this.lstActivity = lstActivity;
	}

	public int getActivityHistoryId() {
		return activityHistoryId;
	}

	public void setActivityHistoryId(int activityHistoryId) {
		this.activityHistoryId = activityHistoryId;
	}

	public String getIpAddress() {
		return ipAddress;
	}

	public void setIpAddress(String ipAddress) {
		this.ipAddress = ipAddress;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public int getTopicId() {
		return topicId;
	}

	public void setTopicId(int topicId) {
		this.topicId = topicId;
	}

	public int getActivityTypeId() {
		return activityTypeId;
	}

	public void setActivityTypeId(int activityTypeId) {
		this.activityTypeId = activityTypeId;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getUsername() {
		return Username;
	}

	public void setUsername(String username) {
		Username = username;
	}

}
